﻿using System.Collections.Generic;
using Project.DBMAPPING;
using Project.DTO;
using Project.IDAO;

namespace Project.DAO
{
    public class ProductAddDAO : IProductAddDAO
    {
        // Declare variable to access database
        readonly DbMappingDataContext _database = new DbMappingDataContext();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="product"></param>
        public void AddProduct(Product product)
        {
            _database.SP_PRODUCT_ADDPRODUCT(product.CategoryID, product.ProductName, product.Supplier,
                product.OriginalValue, product.UnitPrice, null, product.Quantity, product.Description, 
                product.RepresentPicture1, product.RepresentPicture2, product.RepresentPicture3, product.RepresentPicture4, product.RepresentPicture5, true);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IEnumerable<SP_CATEGORY_LOADCATEGORYLISTResult> LoadCategory()
        {
           return _database.SP_CATEGORY_LOADCATEGORYLIST();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IEnumerable<SP_CONSTANTS_LOADCOUNTRYResult> LoadCountry()
        {
            return _database.SP_CONSTANTS_LOADCOUNTRY();
        }
    }
}